package com.frogs.ucenter.v1.service.insurance.base;

import java.util.Calendar;
import java.util.Date;

import com.frogs.framework.util.date.DateUtil;
import com.frogs.ucenter.v1.service.PartnerInsuranceCompanyService;

public abstract class PartnerInsuranceCompanyBaseService implements PartnerInsuranceCompanyService {

	/**
	 * 计算时间
	 * @param start 开始时间
	 * @param period 数量（天数、月数、年数）
	 * @param unit （数量单位：天、月、年）
	 * @return
	 */
	protected static Date getDateAfterDays( Date start, int period ,int unit){
		if(Calendar.YEAR == unit)
			return DateUtil.getDateAfterDays(DateUtil.getDateAfterYears(start, period), -1);
		else if( Calendar.MONTH == unit)
			return DateUtil.getDateAfterDays(DateUtil.getDateAfterMonths(start, period), -1);
		else if(Calendar.DAY_OF_MONTH == unit)
			return DateUtil.getDateAfterDays(DateUtil.getDateAfterDays(start, period), -1);
		else
			return new Date();
	}
}
